# -*- coding: UTF-8 -*-    
# Author:yangshuoshuo
# FileName:logging模块
# DateTime:2024/7/15 22:14
# SoftWare: PyCharm

# 导入日志模块
import logging

# 设置日志输出格式
fmt = "%(asctime)s - %(filename)s [line:%(lineno)d] - %(levelname)s - %(message)s"
# 配置日志
logging.basicConfig(filename="myLog.log", filemode="w", format=fmt, level=logging.DEBUG)
# 调用日志器触发日志信息
logging.debug('This is a debug message')
logging.info('This is an info message')
logging.warning('This is a warning message')
logging.error('This is an error message')
logging.critical('This is a critical message')
